package com.esun.server.controller;

import com.esun.api.interfaces.IExampleApi;
import com.esun.api.request.ExampleRequestDto;
import com.esun.common.response.RestResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;

/**
 * 样例控制器
 * @author John.xiao
 * @date 2021/7/27 10:39
 */
@RestController
@RequestMapping("v1/example")
public class ExampleController  implements IExampleApi {
	@Resource(name = "ExampleApi")
	IExampleApi exampleApi;


	@Override
	public RestResponse getExampleByPage(int pageIndex, int pageSize) {
		return exampleApi.getExampleByPage(pageIndex,pageSize);
	}

	@Override
	public RestResponse addExample(List<ExampleRequestDto> requestDtoList) {
		return exampleApi.addExample(requestDtoList);
	}

	@Override
	public RestResponse updateExample(List<ExampleRequestDto> requestDtoList) {
		return exampleApi.updateExample(requestDtoList);
	}

	@Override
	public RestResponse deleteExample(List<ExampleRequestDto> requestDtoList) {
		return exampleApi.deleteExample(requestDtoList);
	}

	@Override
	public RestResponse importExample(MultipartFile file) {
		return exampleApi.importExample(file);
	}

	@Override
	public void exportExample(ExampleRequestDto requestDto) {
		exampleApi.exportExample(requestDto);
	}

	@Override
	public void downloadTemplate(String path) {
		exampleApi.downloadTemplate(path);

	}
}

